# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer:
pkgname=py3-hidapi
pkgver=0.14.0
pkgrel=1
pkgdesc="Cython interface for hidapi"
url="https://github.com/trezor/cython-hidapi"
arch="all"
license="GPL-3.0-or-later"
makedepends="
	cython
	eudev-dev
	hidapi-dev
	libusb-dev
	py3-gpep517
	py3-setuptools
	py3-wheel
	python3-dev
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/trezor/cython-hidapi/archive/$pkgver.tar.gz"
builddir="$srcdir/cython-hidapi-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--config-json '{"--build-option": ["--with-system-hidapi"]}' \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m unittest -v
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
50152578c2bc80e4b74f8a2ac0a3dbb8f5e3a5a44b6df0d81a4bc732e91171750b4e3aebce625ace7eb88e890da760a20d425eced50d065063846e9fe465858f  py3-hidapi-0.14.0.tar.gz
"
